package com.fz.us.admin.base.bean;

import org.springframework.http.HttpStatus;

/**
 * Bean类 - 结果集
 * ============================================================================
 * 版权所有 2016 。
 *
 * @author fallenpanda
 * @version 1.0 2016-07-21 。
 * ============================================================================
 */
public class Result {

    public Result() {
        super();
    }

    public Result(int state, String message, Object data, HttpStatus statusCode) {
        super();
        this.state = state;
        this.message = message;
        this.data = data;
        this.statusCode = statusCode;
    }

    /**
     * 成功
     */
    public boolean isOK() {
        return state == 1;
    }

    /**
     * 错误
     */
    public boolean isError() {
        return state == 0;
    }

    /**
     * 0失败|1成功|other
     */
    private int state;
    /**
     * 返回信息
     */
    private String message;
    /**
     * 返回结果
     */
    private Object data;
    /**
     * http status
     */
    private HttpStatus statusCode;

    public int getState() {
        return state;
    }

    public void setState(int state) {
        this.state = state;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public HttpStatus getStatusCode() {
        return statusCode;
    }

    public void setStatusCode(HttpStatus statusCode) {
        this.statusCode = statusCode;
    }

}
